<?php
	require_once "../MyControl/config.php";
	$parent_query="SELECT * FROM menu_parent";
	$parent_res=mysqli_query($connection,$parent_query) or die ("Could not select to database!".mysqli_error($connection));
	if($parent_res && mysqli_num_rows($parent_res)>0)
	{
		echo"<div id='menu_tab'>";
		echo"<ul class='menu_big'>";
		while($parent_items = mysqli_fetch_array($parent_res,MYSQLI_ASSOC))
		{
			$item_query="SELECT * FROM menu_items
						WHERE parent_id={$parent_items['id_parent']}";
			$item_res=mysqli_query($connection,$item_query) or die ("Could not select to database!".mysqli_error($connection));
			if($item_res && mysqli_num_rows($item_res)>0)
			{
				echo"<li class='big'><a href='#'>{$parent_items['name_parent']}</a>
				<div class='menu_small'>
				<div class='thongtin'>
				<ul>";
				while($item_items = mysqli_fetch_array($item_res,MYSQLI_ASSOC))
				{
					echo"<li><a href='#'>{$item_items['name_items']}</a></li>";
				}
				echo"</ul></div><div class='hinh_anh'><img src='{$parent_items['HinhMinhHoa']}' alt='image' /></div></div></li>";
			}else{
				echo"<li class='big'><a href='#'>{$parent_items['name_parent']}</a></li>";
			}
			
		}
		echo"<li class='GiamGia'><a href='#'>Hàng Giảm Giá</a></li>";
		echo"</ul>";
		echo"</div>";
	}
	
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="../Another/Style/menu_tab.css"/><br />
<script src="../Another/JQuery/jquery1.9.2.min.js" type="text/javascript"></script>
<script src="../Another/JQuery/menu_tab.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

</body>
</html>